package com.yh.rent.biz.impl;

import java.util.List;

import com.yh.rent.biz.HouseBiz;
import com.yh.rent.dao.HouseDao;
import com.yh.rent.dao.impl.HouseDaoImpl;
import com.yh.rent.entity.Condition;
import com.yh.rent.entity.House;
import com.yh.rent.entity.Page;

public class HouseBizImpl implements HouseBiz {
	HouseDao dao = new HouseDaoImpl() ;
	@Override
	public Page<House> getAllHouseByPage(Integer pageIndex, Integer pageSize) {
		List<House> list = dao.getAllHouseByPage(pageIndex, pageSize) ;
		Page<House> pages = new Page<House>() ;
		pages.setPageIndex(pageIndex);
		pages.setPageSize(pageSize);
		pages.setTotalCount(dao.getTotalCount());
		pages.setPageList(list);
		return pages;
	}
	//分條件 分頁
	@Override
	public Page<House> getHouseByCondition(Integer pageIndex, Integer pageSize, Condition condition) {
		List<House> list = dao.getHouseByCondition(pageIndex, pageSize, condition) ;
		Page<House> pages = new Page<House>() ;
		pages.setPageIndex(pageIndex);
		pages.setPageSize(pageSize);
		pages.setTotalCount(dao.getCountByConditon(condition));
		pages.setPageList(list);
		return pages;
	}
	@Override
	public House getHouseById(Integer id) {
		return dao.getHouseById(id) ;
	}

}
